import threading
import time

import requests

urls = [f'https://api.web.360kan.com/v1/rank?cat={i}' for i in range(1, 7)]

def fetch(url):
    time.sleep(1)
    response = requests.get(url)
    print(f"{threading.current_thread().name}结束")
    print(response.json())

def main():
    print("主线程开始")
    threads = []
    for url in urls:
        thread = threading.Thread(target=fetch, args=(url,))
        thread.start()
        threads.append(thread)
    for thread in threads:
        thread.join()
    print("主线程结束")

if __name__ == '__main__':
    main()
    print(1)





